package org.apache.nifi.redis;

import org.apache.nifi.controller.ControllerService;

/**
 * @author 酷酷的诚
 * @date 2019-08-23 18:52
 */
public interface RedisDistributedLock extends ControllerService {

    /**
     * 加锁
     *
     * @param key   Redis key
     * @param value Redis value
     * @param time  过期时间
     * @return true为加锁成功 false为加锁失败
     */
    public boolean addLock(String key, String value, long time);

    /**
     * 释放锁
     *
     * @param key   Redis key
     * @param value Redis value
     * @return true为释放锁成功 false为释放锁失败
     */
    public boolean releaseLock(String key, String value);

}
